import { contextBridge, ipcRenderer } from "electron";

let current = localStorage.getItem('current');
ipcRenderer.on('currentWindow', (_, cWin) => {
  current = cWin
  localStorage.setItem("current", current)
  console.log(current, 'current----');
  
})
contextBridge.exposeInMainWorld('win', {
  operation: function (type, ...args) {
    ipcRenderer.send('win', current, type, ...args)
  }
})
contextBridge.exposeInMainWorld('tools', {
  ipcSend: function (mes, ...args) {
    ipcRenderer.send(mes, ...args)
  },
  ipcInvoke: function (mes, ...args) {
    return ipcRenderer.invoke(mes, ...args)
  }
})
